//
//  JGCoordinatesMonitor.h
//  JGInputDriver
//
//  Created by jagger.tu on 2025/3/29.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class JGCoordinatesMonitor;
@protocol JGCoordinatesMonitorDelegate <NSObject>


/// 回调经纬度信息
/// - Parameters:
///   - coordinatesMonitor: 回调对象
///   - latitude: 纬度
///   - longitude: 经度
///   - altitude: 海拔
- (void)coordinatesMonitor:(JGCoordinatesMonitor *)coordinatesMonitor latitude:(float)latitude longitude:(float)longitude altitude:(float)altitude;

@end

@interface JGCoordinatesMonitor : NSObject

/// 当设置值时,内部将停止自动发送
@property (nonatomic, weak)id<JGCoordinatesMonitorDelegate> delegate;

/// 当前纬度
@property (nonatomic, assign) double latitude;
/// 当前经度
@property (nonatomic, assign) double longitude;
/// 当前海拔
@property (nonatomic, assign) double altitude;

///请求权限的回调, bFirst: 是否首次请求位置权限 bLocationServicesEnabled: 位置服务器是否关闭
@property (nonatomic,strong) void(^requestAuthorizationCoordinatesMonitor)(JGCoordinatesMonitor * manager,BOOL bFirst, BOOL bLocationServicesEnabled);

/// 错误回调
@property (nonatomic,strong) void(^onError)(NSError *error);

/// 创建一个坐标监视器
/// - Parameters:
///   - requestAuthorization: 申请坐标权限,分别表示是否第一次申请,本地服务是否可以用.如果不是第一次申请需要app层额外弹框申请权限
///   - errorBlock: 表示错误回调
+ (instancetype)coordinatesMonitorWithRequestAuthorizationCoordinatesMonitor:(void(^)(JGCoordinatesMonitor * monitor, BOOL bFirst,BOOL bLocationServicesEnabled))requestAuthorization errorBlock:(void(^)(NSError *error))errorBlock;
/// 开始发送地理位置坐标
- (void)start;
/// 停止发送地址位置坐标
- (void)stop;

@end

NS_ASSUME_NONNULL_END
